package questionary;

import myExceptions.MyFileException;

/**
 * 
 * Clase que contiene la respusta de las preguntas de tipo 4, hereda los metodos 
 * y la informacion de la clase Question
 * @see Questionary
 */
public class MultMultAnsQ extends Question {
	private String [] options;
	private String [] answer;
	
	/**
	 * Construye una pregunta de tipo 4
	 * @param question La pregunta
	 * @param answer Las respuestas
	 * @param options Las opciones de la pregunta
	 * @param diffic La dificultad
	 * @param score El puntaje
	 */
	public MultMultAnsQ(String question, String[] answer, String[] options, int diffic, int score) {
		super(4, diffic, score, question);
		this.options = options;
		this.answer = answer;
	}

	@Override
	public int getOptionsCount() {
		return options.length;
	}

	@Override
	public String[] getOptions() {
		return options;
	}

	@Override
	public boolean isCorrect(String[] s, int answsize) {
		if( answer.length != answsize ){
			return false;
		}
		for (int i = 0; i < answsize; i++) {
			if ( !answer[i].equals(s[i]))
					return false;
			}
		return true;
	}

	@Override
	public boolean isCorrect(String s) {
		if (answer.length > 1)
			return false;
		return answer[0].equals(s);
	}
	
	@Override
	public boolean isCorrect(Number n) {
		return isCorrect(n.toString());
	}

	@Override
	public String[] getAnswers() {
		return answer;
	}
	
	@Override
	public int getCorrectOptionsCount() {
		return answer.length;
	}

	@Override
	public void setOptions(String[] array) {
		this.options = array;		
	}

	@Override
	public void setAnswers(String[] array) throws MyFileException {
		this.answer = array;		
	}

	@Override
	public boolean isCorrect(String[] s) {
		// TODO Ap�ndice de m�todo generado autom�ticamente
		return false;
	}
}
